home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 741 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  4.0 KB

  1. From: bill@amber.ssd.hcsc.com (Bill Leonard)
  2. Message-ID: <4ictfr$r43@ns.hcsc.com>
  3. X-Original-Date: 15 Mar 1996 23:11:55 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 16 Mar 96 10:15:46 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: String value of enum
  9. Organization: Harris Computer Systems, Ft. Lauderdale FL
  10. References: <4i5sf3$89c@hermes.is.co.za> <Do81tp.H9u@rsvl.unisys.com> <KANZE.96Mar14131235@gabi.gabi-soft.fr>
  11. Reply-To: Bill.Leonard@mail.hcsc.com
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMUqU6eEDnX0m9pzZAQH7XQF/b4mgwGpyRAKsrSBKkUuedmAAvk6hAKn2
  14.     qcRmZPi7MZ57rd53e8iIOHKqlZW/FdNa
  15.     =QMZI
  16.  
  17. In article <KANZE.96Mar14131235@gabi.gabi-soft.fr>, kanze@gabi-soft.fr
  18. (J. Kanze) writes:
  19.  
  20. > Well, it is supported in other languages.  But I agree that it will not
  21. > be in C++, and should not be there, for an entirely different reason.
  22. > What happens to such strings when you change locale?  (In practice, they
  23. > are only good for debugging because of this.  And any decent debugger
  24. > will be able to display the information without the table in the
  25. > compiler.)
  26.  
  27. It is true that any decent debugger should be able to display it.  But, I
  28. often write debug code in my programs (for instance, to display complicated
  29. data structures in an intelligent fashion) that a debugger *cannot* display
  30. as well because it doesn't know the details of the structures.
  31. Furthermore, there are often times when the debug code gets executed
  32. without a debugger being used.
  33.  
  34. In fact, our debugger even has a mechanism that allows you to load
  35. additional object code into a running program, partly so that you can write
  36. custom debug functions like this and call them from the debugger!
  37.  
  38. But I disagree with the statement that "these are only good for debugging
  39. because [they cannot be internationalized]".  As a case in point, consider
  40. a C++ compiler that had an enum for all the C++ keywords.  Will those
  41. keywords change when the compiler is internationalized?  No.  Wouldn't it
  42. be nice if the enum names could be automatically turned into strings for
  43. things like error messages?  (Okay, you might have to massage the strings
  44. because the enum values are not spelled exactly like the keywords, but you
  45. might use enum values like KWD_const, KWD_namespace, etc.)
  46.  
  47. Programs that have a command language (like a debugger perhaps?) also
  48. frequently have enums for all the commands they accept.  Again, the
  49. spelling is not usually affected by internationalization, and it is common
  50. to translate between enum value and the string version.
  51.  
  52. > What happens to such strings when you change locale?
  53.  
  54. Why is this a problem?  I wouldn't expect *anything* to happen to them.
  55.  
  56. > Now this is going to be really fun to maintain.
  57.  
  58. Exactly why it would be better for this to be built into the language.
  59.  
  60. > What happens when the
  61. > program is prepared for internationalization, and the translater
  62. > modifies the strings?
  63.  
  64. If it were built into the language, he wouldn't do that, would he? :-)
  65.  
  66. -- 
  67. Bill Leonard
  68. Harris Computer Systems Corporation
  69. 2101 W. Cypress Creek Road
  70. Fort Lauderdale, FL  33309
  71. Bill.Leonard@mail.hcsc.com
  72.  
  73. These opinions and statements are my own and do not necessarily reflect the
  74. opinions or positions of Harris Computer Systems Corporation.
  75.  
  76. ------------------------------------------------------------------------------
  77. There's something wrong with an industry in which amazement is a common
  78. reaction to things going right.
  79.  
  80. "Hard work never scared me.  Oh, sure, it has startled me from a distance."
  81.                                                        -- Professor Fishhawk
  82. ------------------------------------------------------------------------------
  83. ---
  84. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  85. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  86. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  87. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  88. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  89.